package com.zxy.designpattern.observerpattern;

/**
 * Lifecycle.
 * 
 * <p>
 * Subject类需要实现的接口
 * </p>
 * 
 * Created by zxybird on 17/1/17.
 */
public interface Lifecycle {

  public static final String START_EVENT = "start";
  public static final String BEFORE_START_EVENT = "before_start";
  public static final String AFTER_START_EVENT = "after_start";
  public static final String STOP_EVENT = "stop";
  public static final String BEFORE_STOP_EVENT = "before_stop";
  public static final String AFTER_STOP_EVENT = "after_stop";

  public void addLifecycleListener(LifecycleListener listener);

  public LifecycleListener[] findLifecycleListeners();

  public void removeLifecycleListener(LifecycleListener listener);

  public void start() throws LifecycleException;

  public void stop() throws LifecycleException;

}
